package thread;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: nn
 * Date: 2025-05-03
 * Time: 下午2:46
 */
public class Demo22 {
    public static void main(String[] args) {
        Object locker1 = new Object();
        Object locker2 = new Object();

        Thread t1 = new Thread(() ->{
            synchronized(locker1){
                try {
                    Thread.sleep(5000);
                } catch (InterruptedException e) {//12
                    e.printStackTrace();
                }

                synchronized(locker2){
                    System.out.println("t1获得了两把锁");
                }
            }
        });
    }
}
